package xuexi;


class Color{
    private static final Color RED=new Color("红色");
    private static final Color GREEN=new Color("绿色");
    private static final Color BULE=new Color("蓝色");
    private String color;
    private Color(String color) {
        this.color = color;
    }

    @Override
    public String toString() {
        return this.color;
    }

    public static Color getColor(String c){
        switch (c){
            case "red":return RED;
            case "green":return GREEN;
            case "bule":return BULE;
            default:return null;
        }
    }

}
public class Multiple {
    public static void main(String[] args){
        Color c1=Color.getColor("red");
        System.out.println(c1.toString());
    }
}
